<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.01.
   家居公司订单模型($$)*/

!defined('Q_PATH') && exit;

class JiajuorderModel extends CommonModel{

	static public function init__(){
		return array(
			'table_name'=>'jiajuorder',
			'autofill'=>array(
				array('user_id','userId','create','callback'),
				array('jiajuorder_username','userName','create','callback'),
				array('jiajuorder_edituserid','userId','all','callback'),
				array('jiajuorder_editusername','userName','all','callback'),
			),
			'check'=>array(
				'jiajuorder_realspace'=>array(
					array('require',Q::L('建筑面积不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('number',Q::L('建筑面积只能为数字','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajuorder_realname'=>array(
					array('require',Q::L('预约人姓名不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',20,Q::L('预约人姓名不能超过20个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajuorder_mobile'=>array(
					array('require',Q::L('预约人手机号码不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('mobile',Q::L('预约人手机号码格式错误','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajuorder_qq'=>array(
					array('require',Q::L('预约人QQ不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',20,Q::L('预约人QQ不能超过20个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajuorder_address'=>array(
					array('max_length',150,Q::L('预约人住址不能超过150个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajuorder_remark'=>array(
					array('max_length',250,Q::L('预约人其他要求不能超过250个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
			),
		);
	}

	static function F(){
		$arrArgs=func_get_args();
		return ModelMeta::instance(__CLASS__)->findByArgs($arrArgs);
	}

	static function M(){
		return ModelMeta::instance(__CLASS__);
	}

	protected function beforeSave_(){
		$this->jiajuorder_realspace=intval($this->jiajuorder_realspace);
		$this->jiajuorder_realname=C::text($this->jiajuorder_realname);
		$this->jiajuorder_mobile=C::text($this->jiajuorder_mobile);
		$this->jiajuorder_qq=C::text($this->jiajuorder_qq);
		$this->jiajuorder_address=C::text($this->jiajuorder_address);
		$this->jiajuorder_remark=C::text($this->jiajuorder_remark);
		$this->jiajuorder_username=C::text($this->jiajuorder_username);
		$this->jiajuorder_editusername=C::text($this->jiajuorder_editusername);
	}

}
